package co.edu.unal.satacredito.administration.view.franchise;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;

import co.edu.unal.satacredito.administration.view.general.AdministrationBean;
import co.edu.unal.satacredito.franchises.infrastructure.dto.FranchiseDTO;
import co.edu.unal.satacredito.franchises.mediation.FranchisesEJBLocal;

@ManagedBean(name = "listFranchises")
public class ListFranchises extends AdministrationBean {

	@EJB
	FranchisesEJBLocal franchisesEJB;

	List<FranchiseDTO> franchises;

	@PostConstruct
	public void init() {
			System.out.println("Postconstruct: listFranchises");
			franchises = franchisesEJB.getAllFranchises();
	}

	/**
	 * Obtain the complete list of franchises
	 * 
	 * @return
	 */
	public String getAllFranchises() {

			return LIST_FRANCHISES;
	}

	public List<FranchiseDTO> getFranchises() {
		return franchises;
	}

}
